//简便运算：交换率，分配率，连减，连除，
//" ÷ "," × "," + "," - "
var mathSimple = {
     types:["加法交换律三个数","加法交换律四个数","乘法交换律","乘法分配律","分配律逆运算","连续减","连续除"],
     run(len=1){
        let arr=[];
        for(let i=0;i<len;i++){
            let index=fun.rand(0,this.types.length-1);
            arr.push(this[this.types[index]]());
        }
        return arr;
     },
     乘法分配律(){
        let a=fun.rand(1,99);
        let c=fun.rand(1,10);
        let b=fun.rand(0,10)>5?1000:100;
        return {
            exp:[a,"×","(",b,"+",c,")"],
            r:a*b+a*c,
        }

     },
     分配律逆运算(){
        let b=fun.rand(1,999);
        let bc=b>500?1000:Math.ceil(b/100)*100;
        let c=bc-b;
        let a=fun.rand(1,99);
        return {
            exp:[a,"×",b,"+",a,"×",c],
            r:a*b+a*c,
        }
     },
     连续减(){
        let b=fun.rand(1,999);
        let bc=b>500?1000:Math.ceil(b/100)*100;
        let c=bc-b;
        let a=bc+fun.rand(1,999);
        return {
            exp:[a,"-",b,"-",c],
            r:a-b-c,
        }
     },
     连续除(){
        let a=fun.rand(200,9000);
        let arr=[25,4];
        if(a>=1000&&fun.rand(0,10)>5){
            arr[125,8];
        }
        let bc=arr[0]*arr[1];
        let r=Math.floor(a/bc);
        let ys=a%bc;
        if(ys>0){
            r=r+"......"+ys;
        }
        return {
            exp:[a,"÷",arr[0],"÷",arr[1]],
            r,
        }
     },
     乘法交换律(){
        let arr=[25,4,125,8,12,16,32,50];
        arr.push(fun.rand(10,99));
        fun.array_rand(arr);
        return {
            exp:[arr[0],"×",arr[1],"×",arr[2]],
            r:arr[0]*arr[1]*arr[2],
        }
     },
     加法交换律三个数(){
        let a=fun.rand(1,999);
        let ac=a>500?1000:Math.ceil(a/100)*100;
        let c=ac-a;
        let b=fun.rand(1,999);
        let arr=[a,b,c];
        fun.array_rand(arr);
        return {
            exp:[arr[0],"+",arr[1],"+",arr[2]],
            r:ac+b,
        }
     },
     加法交换律四个数(){
        let a=fun.rand(1,999);
        let ac=a>500?1000:Math.ceil(a/100)*100;
        let c=ac-a;
        let b=fun.rand(1,999);
        let bd=b>500?1000:Math.ceil(b/100)*100;
        let d=bd-b;
        let arr=[a,b,c,d];
        fun.array_rand(arr);
        return {
            exp:[arr[0],"+",arr[1],"+",arr[2],"+",arr[3]],
            r:ac+bd,
        }
     }
}